package nid;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

import java.io.IOException;

/**
 * @author lester
 * @since 2021/11/11 13:49
 **/
public class OkHttp {

    public static void main(String[] args) throws IOException {
        String url = "http://localhost:8801/";
        String run = run(url);
        System.out.println(run);
    }


    static String run(String url) throws IOException {
        OkHttpClient client = new OkHttpClient();

        Request request = new Request.Builder()
                .url(url)
                .build();

        try (Response response = client.newCall(request).execute()) {
            return response.body().string();
        }
    }

}
